﻿using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.Events;
using Autodesk.Revit.UI;
using RestSharp;
using System;
using System.Reflection;

namespace Rvt2ifcTool
{
	//[TransactionAttribute(Autodesk.Revit.Attributes.TransactionMode.Manual)]

	//public class Rvt2ifcCommand : IExternalCommand
	//{
	//	//public override Result ExecuteEvent()

	//	public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
	//	{
	//		//Assembly.LoadFile("D:\\xeokit\\rvt2ifc\\Rvt2ifcTool\\bin\\Debug\\RestSharp.dll");
	//		//RestClient client = new RestClient("http://baidu.com/user/login");
	//		Globle.gMyHandler = new RevitHandler(); //外部事件声明
	//		Globle.gExEvent = ExternalEvent.Create(Globle.gMyHandler);

	//		//调用WCF客户端
	//		WaittingForm form = new WaittingForm();
	//		form.Show();
	//		return Result.Succeeded;

	//	}


	//}

	[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
	[Autodesk.Revit.Attributes.Regeneration(Autodesk.Revit.Attributes.RegenerationOption.Manual)]
	public class Rvt2ifcCommand : IExternalApplication
	{
		public Result OnStartup(UIControlledApplication uiControlledApplication)
		{
			Globle.gMyHandler = new RevitHandler(); //外部事件声明
			Globle.gExEvent = ExternalEvent.Create(Globle.gMyHandler);

			//调用WCF客户端
			WaittingForm form = new WaittingForm();
			form.Show();
			return Result.Succeeded;
		}
		public Result OnShutdown(UIControlledApplication application) { return Result.Succeeded; }
	}
}
